<%--
  Created by IntelliJ IDEA.
  User: TLY
  Date: 2022/12/8
  Time: 11:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="./common/taglibs.jsp"%>
${jquery_js}
${validate_jquery_js}
${form_jquery_js}

<html>
<head>
    <title>理发店业务管理系统</title>
    <link type="text/css" rel="stylesheet" href="${ctx}/css/style.css" />
</head>
<body>
<div id="header" class="wrap">

    <div class="navbar">
        <ul class="clearfix">
            <li ><a href="${ctx}/index.jsp">首页</a></li>
            <li ><a href="${ctx}/user/getpageusers">会员管理</a></li>
            <li class="current"><a href="${ctx}/staff/getstaffs">职工管理</a></li>
            <li><a href="${ctx}/order/getorders">订单管理</a></li>
        </ul>
    </div>
</div>
<div id="childNav">
    <div class="welcome wrap">
        管理员${admin.name}您好，欢迎回到管理后台。
    </div>
</div>

<div id="main" class="wrap">
    <div id="menu-mng" class="lefter">
        <div class="box">
            <dl>
         <%--       <dt><a href="${ctx}/user/getpageusers">会员管理</a></dt>
                <dd><em></em><a href="${ctx}/useradd.jsp">新增会员</a></dd>
                <dd><em></em><a href="${ctx}/topUp.jsp">会员充值</a></dd>--%>
                <dt>职工管理</dt>
                <dd><em></em><a href="${ctx}/addstaff.jsp">新增职工</a></dd>
       <%--         <dt>订单管理</dt>
                <dd><em></em><a href="${ctx}/pageproductclass">新增订单</a></dd>--%>
            </dl>
        </div>
    </div>
    <div class="main">
        <h2>职工管理</h2>
        <div class="manage">
            <form id="myform" action="${ctx}/staff/getstaffs" method="post">

                职工id：<input type="text" name="staffid" id="staffid" value="${searchstaff.staffid}" maxlength="5">
                职工姓名：<input type="text" name="staffname" id="staffname" value="${searchstaff.staffname}" maxlength="10">
                <label class="ui-blue"><input type="submit"  id="subsearch" value="查询" /></label>


            </form>
            <table class="list">
                <tr>
                    <th>职工id</th>
                    <th>姓名</th>
                    <th>工作技能</th>
                    <th>手机</th>
                    <th>月薪</th>
                    <th>操作</th>
                </tr>

                <c:forEach items="${staffs}" var="i">
                    <tr>
                        <td class="first w4 c">${i.staffid}</td>
                        <td class="w1 c">${i.staffname}</td>
                        <td class="w4 c">
                            <c:forEach items="${i.skills}" var="j">
                                ${j.skillname}
                </c:forEach>
                        </td>
                        <td class="w4 c">${i.phone}</td>
                        <td class="w4 c">${i.salary}</td>
                        <td class="w1 c"><a href="${ctx}/staff/updatestaff/${i.staffid}">修改</a> <a class="mymanageDel" id="del" href="javascript:void(0)" rel="${i.staffid}">删除</a></td>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </div>
    <div class="clear">

    </div>
</div>

<div id="footer">
    安徽大学江淮学院 2019级 计算机科学与技术专业 陶龙宇 学号JB194033
</div>
<script type="text/javascript">
    $(function () {
        $("#subsearch").click(function () {

            $("#pageIndex").val(1);
            $("#myform").submit();

        })

        $(".mymanageDel").click(function () {
            if(confirm("你确定要删除吗")){
                var id = $(this).attr("rel");
                $.post("${ctx}/staff/del/"+id,function (result){
                    alert(result.msg);
                    if (result.code==10000){
                        location.href="${ctx}/staff/getstaffs"
                    }
                },"json")
            }
            })


 })

</script>

</body>
</html>
